//
//  LBTeacherIntroduceCell.m
//  V-Learn
//
//  Created by Apple on 2019/1/3.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "LBTeacherIntroduceCell.h"

@implementation LBTeacherIntroduceCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifferCell = @"LBTeacherIntroduceCell";
    LBTeacherIntroduceCell *cell = [tableView dequeueReusableCellWithIdentifier:identifferCell];
    if (!cell) {
        cell = [[LBTeacherIntroduceCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifferCell];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    
    return cell;
}
- (void)setupUI{
    

//    self.titleLab = [UILabel labelWithText:@"讲师介绍" andTextColor:rgb(51,51,51) andName:nil andFontSize:15*kScaleFit];
//
//    [self.contentView addSubview:self.titleLab];
//    [self.titleLab makeConstraints:^(MASConstraintMaker *make) {
//        make.left.top.mas_equalTo(15*kScaleFit);
//    }];
    
    self.icon = [[UIImageView alloc] init];
    self.icon.image = [UIImage imageNamed:@"logo"];
    self.icon.layer.cornerRadius = 55;
    self.icon.layer.masksToBounds = YES;
    [self.contentView addSubview:self.icon];
    [self.icon makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(39*kScaleFit);
        make.size.mas_equalTo(CGSizeMake(110*kScaleFit, 110*kScaleFit));
        make.centerX.mas_equalTo(self.contentView);
    }];
    
    self.nameLab = [UILabel labelWithText:@"姜秋云" andTextColor:rgb(40,40,40) andName:nil andFontSize:15*kScaleFit];
    
    [self.contentView addSubview:self.nameLab];
    [self.nameLab makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.icon.mas_bottom).mas_equalTo(9*kScaleFit);
        make.centerX.mas_equalTo(self.contentView);
    }];
//
    self.contentLab = [UILabel labelWithText:@"清华大学出版社儿童发展研究中心、尚学文化公司前CEO；北京双清国际学校主要创办人、首任校长；学前教育学、英语语言文学双专业，国家心理咨询师，婚姻情感导师；清华幼儿英语》和《清华幼儿汉语》两套教材体系的核心研发带头人，清华Kinderpower品牌联合创始人，清华学前双语教育十三年资深教研员，始终不离教学一线，最接地气的儿童教育专家；两个孩子的妈妈，老大小西曾获2017年CCTV希望之星英语大赛北京赛区第七名；曾是全国七千家幼儿园和培训学校的教学、管理培训导师；创办双语父母成长训练营、普妈牛娃万人规划培训项目；【双语家庭系统启蒙】工程发起人，创建双语家庭完全解决方案整套体系，以三年规划的系统、科学地在两种语言下，三年达到英语自由、独立阅读章节书。" andTextColor:rgb(101,101,101) andName:nil andFontSize:12*kScaleFit];
    self.contentLab.numberOfLines = 0;
    [self.contentView addSubview:self.contentLab];
    [self.contentLab makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.nameLab.mas_bottom).mas_equalTo(18*kScaleFit);
        make.right.mas_equalTo(-15*kScaleFit);
        make.bottom.mas_equalTo(-20*kScaleFit);
        make.left.mas_equalTo(15*kScaleFit);
    }];
    
}
- (void)setModel:(LBTeacherModel *)model{
    _model = model;
    NSString *urlString = [NSString stringWithFormat:@"%@%@",Public_URL,model.teacherImage];
    [self.icon sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[UIImage imageNamed:@"logo"]];
    self.nameLab.text = model.teacherName;
    self.contentLab.text = model.teacherInfo;
//    self.titleLab.text = model.teachName;
    
}
@end
